#ifndef LOGMODEL_H
#define LOGMODEL_H

#include <QAbstractListModel>
#include <QList>
#include "logitem.h"

class LogModel : public QAbstractListModel
{
    Q_OBJECT
public:
    enum LogRoles {
        TypeRole = Qt::UserRole + 1,
        VersionRole,
        LineRole,
        FileRole,
        FunctionRole,
        CategoryRole,
        MsgRole,
        TimeRole,
        MsgOnlyRole
    };
    explicit LogModel(QObject *parent = 0);
    int rowCount(const QModelIndex & parent = QModelIndex()) const;

    QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
    void reset();

signals:

public slots:
    void clear();
    void add(const LogItem &log);
protected:
    QHash<int, QByteArray> roleNames() const;
private:
    QList<LogItem> m_list;

};

#endif // LOGMODEL_H
